package designPatterns.P05_适配器模式_Adapter.P02_对象适配器_ObjectAdapter;

import designPatterns.P05_适配器模式_Adapter.P02_对象适配器_ObjectAdapter.adaptors.Adaptor;
import designPatterns.P05_适配器模式_Adapter.P02_对象适配器_ObjectAdapter.adaptors.Adaptor220VTo5V;
import designPatterns.P05_适配器模式_Adapter.P02_对象适配器_ObjectAdapter.adaptors.VoltageValueErrorException;
import designPatterns.P05_适配器模式_Adapter.P02_对象适配器_ObjectAdapter.appliances.Phone;
import designPatterns.P05_适配器模式_Adapter.P02_对象适配器_ObjectAdapter.voltages.Voltage220V;
import designPatterns.P05_适配器模式_Adapter.P02_对象适配器_ObjectAdapter.voltages.Voltage5V;

public class P01 {
    public static void main(String[] args) throws VoltageValueErrorException, CloneNotSupportedException {
        Phone phone = new Phone();
        phone.charge(new Voltage220V());
        phone.charge(new Voltage5V());
        Adaptor adaptor = new Adaptor220VTo5V();
        phone.charge(adaptor.convert(new Voltage220V()));
    }
}
